package com.lxk.seckilldemo.vo;
//公用返回对象
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RespBean {
    private long code;
    private String message;
    private Object obj;
    public static RespBean success(){
        RespBeanEnum respBeanEnum=RespBeanEnum.SUCCESS;
        return new RespBean(respBeanEnum.getCode(),respBeanEnum.getMessage(),null);
    }
    public static RespBean success(Object o){
        RespBeanEnum respBeanEnum=RespBeanEnum.SUCCESS;
        return new RespBean(respBeanEnum.getCode(),respBeanEnum.getMessage(),o);
    }
    public static RespBean error(RespBeanEnum respBeanEnum){
        return new RespBean(respBeanEnum.getCode(),respBeanEnum.getMessage(),null);
    }
    public static RespBean error(RespBeanEnum respBeanEnum,Object obj){
        //RespBeanEnum respBeanEnum=RespBeanEnum.ERROR;
        return new RespBean(respBeanEnum.getCode(),respBeanEnum.getMessage(),obj);
    }
}
